UNPKG

@frames.js/debugger

Version:

Debug your Frames.js applications

1 lines 4.01 kB
"use strict";(()=>{var e={};e.id=555,e.ids=[555],e.modules={20399:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},30517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},49411:e=>{e.exports=require("node:path")},46124:(e,t,a)=>{a.r(t),a.d(t,{headerHooks:()=>b,originalPathname:()=>g,patchFetch:()=>j,requestAsyncStorage:()=>p,routeModule:()=>h,serverHooks:()=>m,staticGenerationAsyncStorage:()=>f,staticGenerationBailout:()=>w});var r={};a.r(r),a.d(r,{GET:()=>d,POST:()=>l});var o=a(95419),n=a(69108),s=a(99678),i=a(98984),u=a(15911);function c(e,t){let{url:a,headers:r,...o}=e,n=new URL(a);if(process.env.DEBUG_HUB_HTTP_URL){let e=new URL(process.env.DEBUG_HUB_HTTP_URL);n.protocol=e.protocol,n.hostname=e.hostname,n.port=e.port}else n.protocol="https",n.hostname="hub-api.neynar.com",n.port="443";return console.log("info: Mock hub: Forwarding message to",n.toString()),n.pathname=t.join("/"),r.set("api_key","NEYNAR_FRAMES_JS"),r.delete("host"),r.delete("referer"),new Request(n,{headers:r,...o})}async function d(e,{params:{hubPath:t}}){let a=await (0,u.K)(e,t);if(a)return i.NextResponse.json(await a.json(),{status:a.status});console.warn(`info: Mock hub: Forwarding message ${t.join("/")} to a real hub`);let r=c(e,t),o=await fetch(r);return i.NextResponse.json(await o.json(),{status:o.status})}async function l(e,{params:{hubPath:t}}){console.warn(`info: Mock hub: Forwarding message ${t.join("/")} to a real hub`);let a=c(e,t),r=await fetch(a);return i.NextResponse.json(await r.json(),{status:r.status})}let h=new o.AppRouteRouteModule({definition:{kind:n.x.APP_ROUTE,page:"/hub/[...hubPath]/route",pathname:"/hub/[...hubPath]",filename:"route",bundlePath:"app/hub/[...hubPath]/route"},resolvedPagePath:"/Users/davidfurlong/Projects/active/frames.js/packages/debugger/app/hub/[...hubPath]/route.ts",nextConfigOutput:"",userland:r}),{requestAsyncStorage:p,staticGenerationAsyncStorage:f,serverHooks:m,headerHooks:b,staticGenerationBailout:w}=h,g="/hub/[...hubPath]/route";function j(){return(0,s.patchFetch)({serverHooks:m,staticGenerationAsyncStorage:f})}},15911:(e,t,a)=>{a.d(t,{K:()=>h,H:()=>p});var r=a(31542);a(68616);let o=require("node:fs/promises");var n=a.n(o),s=a(49411),i=a.n(s);let u=require("node:os");var c=a.n(u);function d(e){return Array.from(e).sort().map(e=>e.join("=")).join("&")}function l(){return i().join(c().tmpdir(),"framesjsmocks.json")}async function h(e,t){let a;let r=l();if(!await n().access(r,n().constants.F_OK).then(()=>!0).catch(()=>!1))return;let o=await n().readFile(r,"utf-8");try{a=JSON.parse(o)}catch(e){console.error(e);return}if(!a.enabled)return;let s=new URL(e.url).searchParams,i=`/${t.join("/")}?${d(s)}`,u=a.requests[i];if(u?.ok!=null)return console.log(`info: Mock hub: Found mock for ${i}, returning ${u.ok?"200":"404"}`),new Response(JSON.stringify(u),{headers:{"content-type":"application/json"},status:u.ok?200:404})}async function p(e){let{mockData:t,untrustedData:a}=await e.clone().json();if(!t||!a?.castId)return;let{fid:r,castId:o}=a,s=`/v1/linkById?${d(new URLSearchParams({fid:r,target_fid:o.fid,link_type:"follow"}))}`,i=`/v1/linkById?${d(new URLSearchParams({fid:o.fid,target_fid:r,link_type:"follow"}))}`,u=`/v1/reactionById?${d(new URLSearchParams({fid:r,reaction_type:"1",target_fid:o.fid,target_hash:o.hash}))}`,c=`/v1/reactionById?${d(new URLSearchParams({fid:r,reaction_type:"2",target_fid:o.fid,target_hash:o.hash}))}`,h=l(),p={enabled:t.enabled,requests:{[s]:{ok:t.enabled&&t.requesterFollowsCaster},[i]:{ok:t.enabled&&t.casterFollowsRequester},[u]:{ok:t.enabled&&t.likedCast},[c]:{ok:t.enabled&&t.recastedCast}}};await n().writeFile(h,JSON.stringify(p,null,2))}(0,a(42053).h)([h,p]),(0,r.j)("0a960cab62b86f19f05335d5152dbfe9d9adee9d",h),(0,r.j)("6af4d9a628e98b577746a391006ba84ccaf97328",p)},95419:(e,t,a)=>{e.exports=a(30517)}};var t=require("../../../webpack-runtime.js");t.C(e);var a=e=>t(t.s=e),r=t.X(0,[1638,8984,9222],()=>a(46124));module.exports=r})();